package cn.iocoder.yudao.module.strategyPlan.dal.mysql.strategyPlan;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.strategyPlan.dal.dataobject.strategyPlan.StrategyPlanDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.strategyPlan.controller.admin.strategyPlan.vo.*;

/**
 * 企业战略-计划 Mapper
 *
 * @author huangjunwei
 */
@Mapper
public interface StrategyPlanMapper extends BaseMapperX<StrategyPlanDO> {

    default PageResult<StrategyPlanDO> selectPage(StrategyPlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StrategyPlanDO>()
                .eqIfPresent(StrategyPlanDO::getId, reqVO.getId())
                .eqIfPresent(StrategyPlanDO::getOrganizationId, reqVO.getOrganizationId())
                .eqIfPresent(StrategyPlanDO::getStrategyId, reqVO.getStrategyId())
                .likeIfPresent(StrategyPlanDO::getPlanName, reqVO.getPlanName())
                .likeIfPresent(StrategyPlanDO::getPlanTartget, reqVO.getPlanTartget())
                .likeIfPresent(StrategyPlanDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(StrategyPlanDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(StrategyPlanDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(StrategyPlanDO::getDecisionUser, reqVO.getDecisionUser())
                .likeIfPresent(StrategyPlanDO::getRemark, reqVO.getRemark())
                .eqIfPresent(StrategyPlanDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(StrategyPlanDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(StrategyPlanDO::getUpdater, reqVO.getUpdater())
                .betweenIfPresent(StrategyPlanDO::getUpdateTime, reqVO.getUpdateTime())
                .eqIfPresent(StrategyPlanDO::getDeleted, reqVO.getDeleted())
                .eqIfPresent(StrategyPlanDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(StrategyPlanDO::getId));
    }

    default List<StrategyPlanDO> selectList(StrategyPlanExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StrategyPlanDO>()
                .eqIfPresent(StrategyPlanDO::getId, reqVO.getId())
                .eqIfPresent(StrategyPlanDO::getOrganizationId, reqVO.getOrganizationId())
                .eqIfPresent(StrategyPlanDO::getStrategyId, reqVO.getStrategyId())
                .likeIfPresent(StrategyPlanDO::getPlanName, reqVO.getPlanName())
                .likeIfPresent(StrategyPlanDO::getPlanTartget, reqVO.getPlanTartget())
                .likeIfPresent(StrategyPlanDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(StrategyPlanDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(StrategyPlanDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(StrategyPlanDO::getDecisionUser, reqVO.getDecisionUser())
                .likeIfPresent(StrategyPlanDO::getRemark, reqVO.getRemark())
                .eqIfPresent(StrategyPlanDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(StrategyPlanDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(StrategyPlanDO::getUpdater, reqVO.getUpdater())
                .betweenIfPresent(StrategyPlanDO::getUpdateTime, reqVO.getUpdateTime())
                .eqIfPresent(StrategyPlanDO::getDeleted, reqVO.getDeleted())
                .eqIfPresent(StrategyPlanDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(StrategyPlanDO::getId));
    }

}
